/*
 * Users.java
 *
 * Created on 11 de Junho de 2007, 00:38
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.epayment.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 * Entity class Users
 * 
 * @author adm
 */
@Entity
@Table(name = "USERS")
@NamedQueries( {
        @NamedQuery(name = "Users.findById", query = "SELECT u FROM Users u WHERE u.id = :id"),
        @NamedQuery(name = "Users.findByFullname", query = "SELECT u FROM Users u WHERE u.fullname = :fullname"),
        @NamedQuery(name = "Users.findByLogin", query = "SELECT u FROM Users u WHERE u.login = :login"),
        @NamedQuery(name = "Users.findByPasswd", query = "SELECT u FROM Users u WHERE u.passwd = :passwd")
    })
public class Users implements Serializable {

    @Id
    @Column(name = "ID", nullable = false)
    private Integer id;

    @Column(name = "FULLNAME", nullable = false)
    private String fullname;

    @Column(name = "LOGIN", nullable = false)
    private String login;

    @Column(name = "PASSWD", nullable = false)
    private String passwd;
    
    /** Creates a new instance of Users */
    public Users() {
    }

    /**
     * Creates a new instance of Users with the specified values.
     * @param id the id of the Users
     */
    public Users(Integer id) {
        this.id = id;
    }

    /**
     * Creates a new instance of Users with the specified values.
     * @param id the id of the Users
     * @param fullname the fullname of the Users
     * @param login the login of the Users
     * @param passwd the passwd of the Users
     */
    public Users(Integer id, String fullname, String login, String passwd) {
        this.id = id;
        this.fullname = fullname;
        this.login = login;
        this.passwd = passwd;
    }

    /**
     * Gets the id of this Users.
     * @return the id
     */
    public Integer getId() {
        return this.id;
    }

    /**
     * Sets the id of this Users to the specified value.
     * @param id the new id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * Gets the fullname of this Users.
     * @return the fullname
     */
    public String getFullname() {
        return this.fullname;
    }

    /**
     * Sets the fullname of this Users to the specified value.
     * @param fullname the new fullname
     */
    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    /**
     * Gets the login of this Users.
     * @return the login
     */
    public String getLogin() {
        return this.login;
    }

    /**
     * Sets the login of this Users to the specified value.
     * @param login the new login
     */
    public void setLogin(String login) {
        this.login = login;
    }

    /**
     * Gets the passwd of this Users.
     * @return the passwd
     */
    public String getPasswd() {
        return this.passwd;
    }

    /**
     * Sets the passwd of this Users to the specified value.
     * @param passwd the new passwd
     */
    public void setPasswd(String passwd) {
        this.passwd = passwd;
    }

    /**
     * Returns a hash code value for the object.  This implementation computes 
     * a hash code value based on the id fields in this object.
     * @return a hash code value for this object.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Determines whether another object is equal to this Users.  The result is 
     * <code>true</code> if and only if the argument is not null and is a Users object that 
     * has the same id field values as this object.
     * @param object the reference object with which to compare
     * @return <code>true</code> if this object is the same as the argument;
     * <code>false</code> otherwise.
     */
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Users)) {
            return false;
        }
        Users other = (Users)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Returns a string representation of the object.  This implementation constructs 
     * that representation based on the id fields.
     * @return a string representation of the object.
     */
    @Override
    public String toString() {
        return "br.unifor.epayment.entity.Users[id=" + id + "]";
    }
    
}
